<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>登录</title>
	<link rel="stylesheet" href="../public/css/index.css" />
	<link rel="stylesheet" href="../public/css/rigist.css" />
</head>
<body>
			<!-- 头部-->
		<?php
		include_once("header.php");
		?>
			<!-- 主体-->
			<div class="main">
				<div class="login">
					
						 <form action="do_regist.php" method="post" >
							<table cellpadding="0" cellspacing="0">
								<tr>
									<td colspan="2"><h1>会员注册</h1></td>
								</tr>
								<tr>
									<td class="td_1">用户名:</td>
									<td><input type="text" name="username" value="" id="user" class="input_1">
										<span id="SpUser"></span></td>
								</tr>
								<tr>
									<td class="td_1">密&nbsp;&nbsp;&nbsp;码:</td>
									<td><input type="password" name="password" value="" id="pwd" class="input_1"><span id="SpPwd"></span></td>
								</tr>
								<tr>
									<td class="td_1">确认密码:</td>
									<td><input type="password" name="pwd" value=""id="pwd2" class="input_1"></td>
								</tr>
								<tr>
									<td class="td_1">手机号码:</td>
									<td><input type="text" name="tel" value=""id="tel" class="input_1"><span id="Sptel"></td>
								</tr>
								<tr>
									<td class="td_1">邮&nbsp;&nbsp;&nbsp;箱:</td>
									<td><input type="text" name="email" value="" id="email" class="input_1"><span id="Spemail"></td>
								</tr>
								<tr>
									<td colspan="2" ><input type="submit" name="sub" value="注  册" class="login_s"></td>
								
						       </tr>
						    </table>
				         </form>
				</div>
 

			</div>



			<!-- 页脚-->
<?php
include_once("footer.php");
?>
</body>
</html>
<script>
		var user = document.getElementById('user');
		var pwd  = document.getElementById('pwd');
		var pwd2  = document.getElementById('pwd2');
		var tel  = document.getElementById('tel');
		var email  = document.getElementById('email');
		var p1  = document.getElementById('SpUser');
		var p2  =document.getElementById('SpPwd');
		var p3  =document.getElementById('Sptel');
		var p4  =document.getElementById('Spemail');	
		var a;
		var b;
		function getuser(){
			var code =/^[a-zA-Z0-9]{4,16}$/;
			var  str = user.value;
			if(code.test(str)){
				p1.innerHTML ="用户名格式正确";
				p1.style.color ='#66ffff';

			}else{
				p1.innerHTML = '用户名格式错误';
				p1 .style.color = '#ff0066';
			}

		}
		user.onblur = getuser();
		user.onfocus = function(){
			p1.innerHTML="";
		}
		function isPwd(){
			var code =/^[a-zA-Z0-9_-]{4,16}$/;
			var str  = pwd.value;
			if(code.test(str)){
				p2.innerHTML ="密码格式正确";
				p2.style.color ='#66ffff';

			}else{
				p2.innerHTML = '密码格式错误';
				p2 .style.color = '#ff0066';
			}
		}
			pwd.onblur = isPwd;
		pwd.onfocus = function(){
			p2.innerHTML="";
		}
		function isTel(){
			var code =/13[123569]{1}\d{8}|15[1235689]\d{8}|188\d{8}/;
			var str  = tel.value;
			if(code.test(str)){
				p3.innerHTML ="手机格式正确";
				p3.style.color ='#66ffff';
			}else{
				p3.innerHTML = '手机格式错误';
				p3 .style.color = '#ff0066';
			}
		}
			tel.onblur = isTel;
		tel.onfocus = function(){
			p3.innerHTML="";
		}
		function isEmail(){
			var code =/^\w+\@\w+\.(cn|org|com)$/;
			var str  = email.value;
			if(code.test(str)){
				p4.innerHTML ="邮箱格式正确";
				p4.style.color ='#66ffff';
			}else{
				p4.innerHTML = '邮箱格式错误';
				p4.style.color = '#ff0066';
			}
		}
			email.onblur = isEmail;
		email.onfocus = function(){
			p4.innerHTML="";
		}

</script>